import { Controller, Get } from '@nestjs/common';
import { Public } from '../../../../../common/public.decorator';
import { TaskService } from './task.service';

@Controller('task')
export class TaskController {
  constructor(private readonly taskService: TaskService) {}

  @Public()
  @Get('openDispatchTest')
  enableScheduledTasks() {
    try {
      this.taskService.enableScheduledTasks();
      return {
        code: 200,
        message: 'success',
        data: true,
      };
    } catch (error) {
      return {
        code: 500,
        message: error.message,
        data: false,
      };
    }
  }
}
